package pro30015_sinoss;

import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class UpdateSchoolInfo {
    public static void main(String[] args) throws Exception {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection tarConn = java.sql.DriverManager.getConnection("dbc:oracle:thin:@172.16.1.3:1521:orcl", "pro30015", "eplugger");
        try{
            DBInfo tarInfo = new DBInfo(tarConn, null, DBName.Oracle);
            File excel = new File("/Users/firefly/project/教育部/代码更新/2016高校代码表ptgxdm-20161230.xlsx");
            Map<String,String> titleColumn = new HashMap<>();
            titleColumn.put("学校代码", "newcode");
            titleColumn.put("学校名称", "name");
            titleColumn.put("办学类型代码", "bxlxCode");
            titleColumn.put("办学类型", "bxlx");
            titleColumn.put("性质类别代码", "xzCode");
            titleColumn.put("性质类别", "xz");
            titleColumn.put("学校举办者代码", "jbzCode");
            titleColumn.put("学校举办者", "jbz");
            titleColumn.put("省市代码", "sfCode");
            titleColumn.put("省市名称", "sf");
            DBUtils.impExcel2DB(tarInfo, excel, "T_UNIT", titleColumn);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally{
            tarConn.close();
        }
    }
}
